#include <stdint.h>
#include "widget.h"
#include "list.h"
#include "../memory.h"


widget_t *widget_create(void)
{
    widget_t *obj = (widget_t *)memory_alloc(sizeof(widget_t));
    obj->widget_type = widget_type_none;
    obj->state = widget_state_none;
    obj->x = 0;
    obj->y = 0;
    obj->h = 0;
    obj->w = 0;
    list_init(&obj->node);
    return obj;
}

void widget_set_pos(widget_t *obj, int x, int y)
{
    obj->x = x;
    obj->y = y;
}

void widget_set_size(widget_t *obj, int w, int h)
{
    obj->w = w;
    obj->h = h;
}

uint8_t widget_get_width(widget_t *obj)
{
    return obj->w;
}

uint8_t widget_get_height(widget_t *obj)
{
    return obj->h;
}

uint8_t widget_get_x(widget_t *obj)
{
    return obj->x;
}
uint8_t widget_get_y(widget_t *obj)
{
    return obj->y;
}

may_screen_t *screen_create(int w, int h)
{
    may_screen_t *screen = (may_screen_t *)memory_alloc(sizeof(may_screen_t));

    screen->obj.widget_type = widget_type_screen;
    screen->obj.x = 0;
    screen->obj.y = 0;
    screen->obj.h = h;
    screen->obj.w = w;
    list_init(&screen->obj.node);
    return screen;
}

widget_t *screen_get(void *obj)
{
    widget_t *screen = (widget_t *)obj;
    return screen;
}

void widget_init(void)
{
    ;
}